package com.alan.wifishare.app;

import android.app.Application;
import android.os.Handler;

import com.alan.libapi.business.dao.BusinessHttpImpl;
import com.alan.libapi.business.dao.BusinessTcpImpl;
import com.alan.library.allog.KLog;
import com.alan.wifishare.BuildConfig;
import com.alan.wifishare.model.business.UserLocation;
import com.alan.wifishare.presenter.proxy.BusinessHttpProxy;
import com.alan.wifishare.presenter.proxy.BusinessTcpProxy;
import com.alan.wifishare.utils.WifiUtil;
import com.alan.wifishare.view.impl.service.NetworkManagerService;
import com.baidu.mapapi.SDKInitializer;

import java.util.ArrayList;

/**
 * @className: WSApplication
 * @describtion: WSApplication
 * @author: AlanWang
 * @email: 850267876@qq.com
 * @time: 2016/4/20 15:22
 */
public class WSApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        initApp();
    }

    private void initApp() {
        KLog.init(BuildConfig.LOG_DEBUG);
        GlobalField.context = this;
        GlobalField.handler = new Handler();
        GlobalField.wifiUtil = new WifiUtil(this);
        GlobalField.businessHttp = new BusinessHttpProxy(BusinessHttpImpl.getInstance()).getApiInstance();
        GlobalField.businessTcp = new BusinessTcpProxy(BusinessTcpImpl.getInstance()).getApiInstance();
        GlobalField.userConfig = UserConfig.getInstance(this);
        GlobalField.userLocation = new UserLocation();
        GlobalField.sharedWifiInfoList = new ArrayList<>();
        SDKInitializer.initialize(this);
        NetworkManagerService.startService(this);
    }
}
